import unittest


class DemoTestCase(unittest.TestCase):
    def test1(self):
        print('test1')

    def test2(self):
        print('test2')


class Demo2TestCase(unittest.TestCase):
    def testa(self):
        print('testa')

    def testb(self):
        print('testb')


if __name__ == '__main__':
    # unittest.main(verbosity=2)
    # suite 测试套件
    suite = unittest.TestSuite()
    # 套单个
    # suite.addTest(DemoTestCase('test1'))
    # suite.addTest(Demo2TestCase('testa'))

    # 套多个
    # 定义一个可迭代对象,这里用list
    tests = [
        Demo2TestCase('testa'),
        DemoTestCase('test1')
    ]
    suite.addTests(tests)
    # runner 执行器
    runner = unittest.TextTestRunner(verbosity=2)
    runner.run(suite)
